function C_setArduinoDevice(ID,SerialPort);

global CG
  
CG.Sessions.Arduino(ID).S=serial(SerialPort,...
  'BaudRate',CG.Parameters.Arduino.BaudRate,...
  'InputBufferSize',CG.Parameters.Arduino.InputBufferSize,...
  'BytesAvailableFcnMode',CG.Parameters.Arduino.BytesAvailableFcnMode,...
  'BytesAvailableFcn',{@C_callbackArduinoIn,ID},...
  'TimeOut',0.1);
CG.Devices.Arduino.HandlesAvailable = setdiff(CG.Devices.Arduino.HandlesAvailable,SerialPort);
CG.Sessions.Arduino(ID).SerialPort  = SerialPort;